home *** CD-ROM | disk | FTP | other *** search
/ Champak 120 / Vol 120.iso / games / bounce_c.swf / scripts / frame_70 / DoAction.as
Encoding:
Text File  |  2010-11-09  |  23.5 KB  |  886 lines

  1. function bombField(xPos, yPos, blastRadius)
  2. {
  3.    var _loc2_ = new flash.geom.Matrix();
  4.    _loc2_.translate(xPos,yPos);
  5.    _root.hole_mc.holeResize._xscale = blastRadius;
  6.    _root.hole_mc.holeResize._yscale = blastRadius;
  7.    myBmp.draw(hole_mc,_loc2_,myCT,"erase");
  8.    myHouseBmp.draw(hole_mc,_loc2_,myCT,"erase");
  9. }
  10. function cleanSweep(xStart)
  11. {
  12.    var _loc1_ = 0;
  13.    while(_loc1_ < 50)
  14.    {
  15.       xTest = xStart - majorX;
  16.       yTest = 250 + _loc1_ * 5 + majorY;
  17.       if(myBmp.getPixel(xTest,yTest) != 0)
  18.       {
  19.          if(myBmp.getPixel(xTest + 5,yTest) == 0 && myBmp.getPixel(xTest - 5,yTest) == 0)
  20.          {
  21.             if(myBmp.getPixel(xTest,yTest + 5) == 0 && myBmp.getPixel(xTest,yTest - 5) == 0)
  22.             {
  23.                bombField(xTest,yTest,20);
  24.             }
  25.          }
  26.       }
  27.       _loc1_ += 1;
  28.    }
  29. }
  30. function cleanSweepVert(yStart)
  31. {
  32.    var _loc1_ = 0;
  33.    while(_loc1_ < 80)
  34.    {
  35.       xTest = _loc1_ * 5 + majorX;
  36.       yTest = yStart - majorY;
  37.       if(myBmp.getPixel(xTest,yTest) != 0)
  38.       {
  39.          if(myBmp.getPixel(xTest + 5,yTest) == 0 && myBmp.getPixel(xTest - 5,yTest) == 0)
  40.          {
  41.             if(myBmp.getPixel(xTest,yTest + 5) == 0 && myBmp.getPixel(xTest,yTest - 5) == 0)
  42.             {
  43.                bombField(xTest,yTest,20);
  44.             }
  45.          }
  46.       }
  47.       _loc1_ += 1;
  48.    }
  49. }
  50. function speedRush()
  51. {
  52.    ballBounce.play();
  53.    if(Math.abs(xSpeed) > Math.abs(ySpeed))
  54.    {
  55.       ySpeed = maxSpeed / Math.abs(xSpeed) * ySpeed;
  56.       xSpeed *= 50;
  57.    }
  58.    else
  59.    {
  60.       xSpeed = maxSpeed / Math.abs(ySpeed) * xSpeed;
  61.       ySpeed *= 50;
  62.    }
  63. }
  64. function bombDrop()
  65. {
  66.    if(ballFreeze == false)
  67.    {
  68.       if(bombTimer <= 0)
  69.       {
  70.          bombTimer = bombTimegap;
  71.          attachMovie("bombDrop","bombDrop" + bombID,750 + bombID);
  72.          _root["bombDropMove" + bombID] = 0;
  73.          _root["bombDropX" + bombID] = 200 - majorX;
  74.          _root["bombDropY" + bombID] = 300 + majorY;
  75.          _root["bombDrop" + bombID]._x = 200;
  76.          _root["bombDrop" + bombID]._y = 300;
  77.          _root["bombDrop" + bombID].exploded = false;
  78.          bombID += 1;
  79.          if(bombID >= 20)
  80.          {
  81.             bombID = 1;
  82.          }
  83.       }
  84.    }
  85. }
  86. function makeMap()
  87. {
  88.    attachMovie("map1","map1",110);
  89.    map1.gotoAndStop(_root.currentLevel);
  90.    myBmp.draw("map1",myMatrix,myCT,"layer");
  91.    removeMovieClip("map1");
  92. }
  93. function makeHouseMap()
  94. {
  95.    attachMovie("map2","map2",105);
  96.    map2.gotoAndStop(_root.currentLevel);
  97.    myHouseBmp.draw("map2",myMatrix,myCT,"layer");
  98.    removeMovieClip("map2");
  99. }
  100. function removeLine()
  101. {
  102.    removeMovieClip(drawLine);
  103.    removeMovieClip(starSpin1);
  104.    removeMovieClip(starSpin2);
  105.    removeMovieClip(mapHolder.starSpin1);
  106.    removeMovieClip(mapHolder.starSpin2);
  107.    removeMovieClip(mapHolder.drawLine);
  108. }
  109. _quality = _root.game_quality;
  110. if(sound_on == true)
  111. {
  112.    bgSound = new Sound(this);
  113.    bgSound.attachSound("track_" + currentLevel);
  114.    bgSound.start(0,99);
  115. }
  116. attachMovie("barSide","barLeft",151);
  117. attachMovie("barSide","barRight",152);
  118. attachMovie("barTop","barTop",153);
  119. attachMovie("barTop","barBase",154);
  120. attachMovie("background1","background1",1);
  121. attachMovie("background2","background2",2);
  122. attachMovie("background3","background3",3);
  123. attachMovie("ballBounce","ballBounce",300);
  124. ballBounce._x = 200;
  125. ballBounce._y = 275;
  126. attachMovie("topMask","topMask",900);
  127. topMask._x = 0;
  128. topMask._y = 0;
  129. topMask.mapDisplay.attachMovie("ballSymbol","ballSymbol",2000);
  130. bitNumber = 20;
  131. bitCount = 0;
  132. var i = 1;
  133. while(i <= bitNumber)
  134. {
  135.    attachMovie("bit","bit" + i,600 + i);
  136.    bitCount += 1;
  137.    topMask.mapDisplay.attachMovie("bitMarker","bitMarker" + i,1950 + i);
  138.    _root["bit" + i].id = i;
  139.    _root["bitStartX" + i] = Math.random() * 1800 + 100;
  140.    _root["bitStartY" + i] = Math.random() * 600 + 100;
  141.    _root["bitSpeedX" + i] = -2;
  142.    _root["bitAlive" + i] = true;
  143.    _root["bitDirectionX" + i] = 2 * Math.round(Math.random()) - 1;
  144.    _root["bitMoveX" + i] = 0;
  145.    _root["bitMoveY" + i] = 0;
  146.    i++;
  147. }
  148. var myMatrix = new flash.geom.Matrix();
  149. var myCT = new flash.geom.ColorTransform(1,1,1,1,0,0,0,0);
  150. var myBmp = new flash.display.BitmapData(2500,1000,true,0);
  151. var myHouseBmp = new flash.display.BitmapData(2500,1000,true,0);
  152. createEmptyMovieClip("mapHolder",709);
  153. mapHolder.attachBitmap(myBmp,10,"never",false);
  154. topMask.mapDisplay.displayMapHolder.attachBitmap(myBmp,11,"never",false);
  155. myMatrix.translate(0,120);
  156. attachMovie("hole","hole_mc",450);
  157. hole_mc._visible = false;
  158. attachMovie("bloodMark","bloodMark",451);
  159. bloodMark._visible = false;
  160. makeMap();
  161. mapHolder.attachBitmap(myHouseBmp,8,"never",false);
  162. topMask.mapDisplay.displayMapHolder.attachBitmap(myHouseBmp,9,"never",false);
  163. makeHouseMap();
  164. array = new Array(360);
  165. ballRadius = ballBounce.innerBall._width / 2;
  166. startDraw = false;
  167. lineStartPointX = 0;
  168. lineStartPoint = 0;
  169. lineEndPointX = 0;
  170. lineEndPointY = 0;
  171. majorX = -800;
  172. majorY = -200;
  173. xSpeed = 0;
  174. ySpeed = 10;
  175. bombID = 1;
  176. bombTimer = 0;
  177. powerUpTimer = 0;
  178. fireSpin = false;
  179. laser = false;
  180. laserShoot = false;
  181. laserDir = 1;
  182. abilityTimer = 0;
  183. powerUpState = false;
  184. poweredUp = false;
  185. chainCrush = 1;
  186. chainLink = 0;
  187. chainLinkMax = 100;
  188. ballFreeze = false;
  189. spaceDown = false;
  190. ballFreeze = true;
  191. bitValue = 90 + currentLevel * 10;
  192. scoreDecreaseTimer = 0;
  193. totalScore = 1000;
  194. abilityTimerMax = 500;
  195. powerUpTimerMax = 700;
  196. maxSpeed = 12;
  197. gravity = 0.4;
  198. speedNudge = 0.8;
  199. bombPower = 60;
  200. bombTimegap = 20;
  201. var mouseListener = new Object();
  202. mouseListener.onMouseWheel = function(delta)
  203. {
  204.    bombDrop();
  205. };
  206. topMask.bombGauge.bombSymbol.onPress = function()
  207. {
  208.    bombDrop();
  209. };
  210. topMask.menuButton.onRollOver = function()
  211. {
  212.    this._xscale = 120;
  213.    this._yscale = 120;
  214. };
  215. topMask.menuButton.onRollOut = function()
  216. {
  217.    this._xscale = 100;
  218.    this._yscale = 100;
  219. };
  220. topMask.menuButton.onPress = function()
  221. {
  222.    _root.gotoAndStop("menuScreen");
  223. };
  224. topMask.music_toggle.onRollOver = function()
  225. {
  226.    this._xscale = 120;
  227.    this._yscale = 120;
  228. };
  229. topMask.music_toggle.onRollOut = function()
  230. {
  231.    this._xscale = 100;
  232.    this._yscale = 100;
  233. };
  234. topMask.music_toggle.onPress = function()
  235. {
  236.    if(sound_on == true)
  237.    {
  238.       sound_on = false;
  239.       bgSound.stop();
  240.    }
  241.    else
  242.    {
  243.       sound_on = true;
  244.       bgSound = new Sound(this);
  245.       bgSound.attachSound("track_" + _root.currentLevel);
  246.       bgSound.start(0,99);
  247.    }
  248. };
  249. topMask.music_toggle.onEnterFrame = function()
  250. {
  251.    if(sound_on == true)
  252.    {
  253.       this.gotoAndStop(2);
  254.    }
  255.    else
  256.    {
  257.       this.gotoAndStop(1);
  258.    }
  259. };
  260. Mouse.addListener(mouseListener);
  261. onMouseDown = function()
  262. {
  263.    if(ballFreeze == false)
  264.    {
  265.       if(_ymouse > 150)
  266.       {
  267.          if(ballBounce.innerBall.hitTest(_xmouse,_ymouse,true))
  268.          {
  269.             speedRush();
  270.          }
  271.          else
  272.          {
  273.             removeLine();
  274.             attachMovie("attachLine","attachLine",850);
  275.          }
  276.       }
  277.    }
  278. };
  279. onMouseUp = function()
  280. {
  281.    if(startDraw == true)
  282.    {
  283.       startDraw = false;
  284.       drawAllowed = true;
  285.       mapHolder.attachMovie("attachLine","drawLine",850);
  286.       mapHolder.drawLine._alpha = 100;
  287.       mapHolder.drawLine._x = attachLine._x - majorX;
  288.       mapHolder.drawLine._y = attachLine._y + majorY;
  289.       mapHolder.drawLine._rotation = drawAngle;
  290.       bounceAngle = drawAngle;
  291.       removeMovieClip(attachLine);
  292.       lineAngle = mapHolder.drawLine._rotation;
  293.    }
  294.    else if(!ballBounce.innerBall.hitTest(_xmouse,_ymouse,true))
  295.    {
  296.       removeLine();
  297.    }
  298.    else
  299.    {
  300.       removeMovieClip(attachLine);
  301.    }
  302. };
  303. _root.onEnterFrame = function()
  304. {
  305.    _quality = _root.game_quality;
  306.    if(Key.isDown(32))
  307.    {
  308.       if(spaceDown == false)
  309.       {
  310.          spaceDown = true;
  311.          bombDrop();
  312.       }
  313.    }
  314.    else
  315.    {
  316.       spaceDown = false;
  317.    }
  318.    removeMovieClip(mapHolder.starSpinFade1);
  319.    removeMovieClip(mapHolder.starSpinFade2);
  320.    mapHolder.drawLine2.clear();
  321.    baseCollision = false;
  322.    topCollision = false;
  323.    leftCollision = false;
  324.    rightCollision = false;
  325.    drawCollision = 1;
  326.    ballLineCollision = false;
  327.    if(xSpeed * ySpeed < 0)
  328.    {
  329.       minLoop = 360;
  330.       maxLoop = 0;
  331.       inc = -10;
  332.    }
  333.    else
  334.    {
  335.       minLoop = 0;
  336.       maxLoop = 360;
  337.       inc = 10;
  338.    }
  339.    lineCollision = false;
  340.    i = minLoop;
  341.    while(i != maxLoop)
  342.    {
  343.       xPos = ballBounce._x + ballRadius * Math.cos(i / 180 * 3.141592653589793);
  344.       yPos = ballBounce._y - ballRadius * Math.sin(i / 180 * 3.141592653589793);
  345.       if(_root.barLeft.hitTest(xPos,yPos,true))
  346.       {
  347.          leftCollision = true;
  348.          chainLink -= 1;
  349.       }
  350.       if(_root.barRight.hitTest(xPos,yPos,true))
  351.       {
  352.          rightCollision = true;
  353.          chainLink -= 1;
  354.       }
  355.       if(_root.barBase.hitTest(xPos,yPos,true))
  356.       {
  357.          baseCollision = true;
  358.          chainLink -= 1;
  359.       }
  360.       if(_root.barTop.hitTest(xPos,yPos,true))
  361.       {
  362.          topCollision = true;
  363.       }
  364.       if(_root.drawLine.hitTest(xPos,yPos,true))
  365.       {
  366.          ballLineCollision = true;
  367.       }
  368.       if(_root.mapHolder.drawLine.hitTest(xPos,yPos,true))
  369.       {
  370.          Array[i] = 1;
  371.          lineCollision = true;
  372.       }
  373.       else if(myBmp.getPixel(xPos - majorX,yPos + majorY) != 0)
  374.       {
  375.          Array[i] = 1;
  376.       }
  377.       else if(myHouseBmp.getPixel(xPos - majorX,yPos + majorY) != 0)
  378.       {
  379.          Array[i] = 1;
  380.       }
  381.       else
  382.       {
  383.          Array[i] = 0;
  384.       }
  385.       i += inc;
  386.    }
  387.    startNode = 0;
  388.    endNode = 0;
  389.    i = minLoop;
  390.    while(i != maxLoop)
  391.    {
  392.       if(lastCheck > 0 && Array[i] > 0)
  393.       {
  394.          startNode = i;
  395.       }
  396.       if(lastCheck > 0 && Array[i] == 0)
  397.       {
  398.          endNode = i;
  399.       }
  400.       lastCheck = Array[i];
  401.       i += inc;
  402.    }
  403.    if(endNode - startNode > 180 || endNode - startNode < -180)
  404.    {
  405.       angle = 0;
  406.    }
  407.    else
  408.    {
  409.       angle = (startNode + endNode) / 2;
  410.    }
  411.    speed = Math.sqrt(xSpeed * xSpeed + ySpeed * ySpeed);
  412.    currentAngle = Math.atan(ySpeed / xSpeed) / 0.017453292519943295;
  413.    if(xSpeed > 0)
  414.    {
  415.       currentAngle += 180;
  416.    }
  417.    if(startNode != endNode)
  418.    {
  419.       if(lineCollision == true)
  420.       {
  421.          if(drawAllowed == true)
  422.          {
  423.             drawAllowed = false;
  424.             xSpeed = maxSpeed * Math.sin((bounceAngle + 90) / 180 * 3.141592653589793);
  425.             ySpeed = maxSpeed * Math.cos((bounceAngle + 90) / 180 * 3.141592653589793);
  426.          }
  427.       }
  428.       else
  429.       {
  430.          xSpeed = speed * Math.sin((angle + 90) / 180 * 3.141592653589793);
  431.          ySpeed = (- speed) * Math.cos((angle + 90) / 180 * 3.141592653589793);
  432.       }
  433.    }
  434.    else
  435.    {
  436.       ySpeed += gravity;
  437.    }
  438.    if(startDraw == true)
  439.    {
  440.       lineEndPointX = _xmouse;
  441.       lineEndPointY = _ymouse;
  442.       drawLine.clear();
  443.       drawLine.lineStyle(8,0,100);
  444.       drawLine.moveTo(lineStartPointX,lineStartPointY);
  445.       drawLine.lineTo(lineEndPointX,lineEndPointY);
  446.    }
  447.    if(xSpeed > maxSpeed)
  448.    {
  449.       xSpeed = maxSpeed;
  450.    }
  451.    if(xSpeed < - maxSpeed)
  452.    {
  453.       xSpeed = - maxSpeed;
  454.    }
  455.    if(ySpeed > maxSpeed)
  456.    {
  457.       ySpeed = maxSpeed;
  458.    }
  459.    if(ySpeed < - maxSpeed)
  460.    {
  461.       ySpeed = - maxSpeed;
  462.    }
  463.    if(baseCollision == true)
  464.    {
  465.       ySpeed = -7;
  466.    }
  467.    if(topCollision == true)
  468.    {
  469.       ySpeed = 7;
  470.    }
  471.    if(leftCollision == true)
  472.    {
  473.       xSpeed = -7;
  474.    }
  475.    if(rightCollision == true)
  476.    {
  477.       xSpeed = 7;
  478.    }
  479.    if(ballFreeze == false)
  480.    {
  481.       majorX += xSpeed * speedNudge;
  482.       majorY += ySpeed * speedNudge;
  483.    }
  484.    if(myBmp.getPixel(ballBounce._x - majorX,ballBounce._y + majorY) != 0)
  485.    {
  486.       bombField(ballBounce._x - majorX,ballBounce._y + majorY,50);
  487.    }
  488.    background1._x = 0 + majorX / 16;
  489.    background1._y = 152;
  490.    background2._x = -100 + majorX / 4;
  491.    background2._y = 80 - majorY / 4;
  492.    background3._x = -200 + majorX / 1.3;
  493.    background3._y = -50 - majorY / 1.3;
  494.    mapHolder._x = 0 + majorX;
  495.    mapHolder._y = - majorY;
  496.    barTop._x = 0 + majorX;
  497.    barTop._y = - majorY;
  498.    barBase._x = 0 + majorX;
  499.    barBase._y = 1000 - majorY;
  500.    barLeft._x = 0 + majorX;
  501.    barLeft._y = - majorY;
  502.    barRight._x = 1990 + majorX;
  503.    barRight._y = - majorY;
  504.    powerUp._x = powerUpX + majorX;
  505.    powerUp._y = powerUpY - majorY;
  506.    var i = 1;
  507.    while(i <= 30)
  508.    {
  509.       if(myHouseBmp.getPixel(_root["bit" + i]._x - majorX,_root["bit" + i]._y - 20 + majorY) != 0)
  510.       {
  511.          if(myHouseBmp.getPixel(_root["bit" + i]._x - 25 - majorX,_root["bit" + i]._y - 20 + majorY) == 0)
  512.          {
  513.             _root["bitDirectionX" + i] = -1;
  514.          }
  515.          if(myHouseBmp.getPixel(_root["bit" + i]._x + 25 - majorX,_root["bit" + i]._y - 20 + majorY) == 0)
  516.          {
  517.             _root["bitDirectionX" + i] = 1;
  518.          }
  519.       }
  520.       else if(ballFreeze == false)
  521.       {
  522.          if(_root["bit" + i].hitTest(ballBounce.hitZone) && _root["bitAlive" + i] == true)
  523.          {
  524.             _root["bitAlive" + i] = false;
  525.             _root["bit" + i].gotoAndPlay("death");
  526.          }
  527.          if(laserShoot == true)
  528.          {
  529.             if(_root["bit" + i].hitTest(laserShot))
  530.             {
  531.                _root["bitAlive" + i] = false;
  532.                _root["bit" + i].gotoAndPlay("death");
  533.                laserShot.removeMovieClip();
  534.                laserShoot = false;
  535.             }
  536.          }
  537.          else if(laser == true)
  538.          {
  539.             if(_root["bit" + i].hitTest(ballBounce.laserLineR))
  540.             {
  541.                laserShoot = true;
  542.                attachMovie("laserShot","laserShot",780);
  543.                laserDir = 1;
  544.                laserShot._x = ballBounce._x + 35;
  545.                laserShot._y = ballBounce._y;
  546.             }
  547.             if(_root["bit" + i].hitTest(ballBounce.laserLineL))
  548.             {
  549.                laserShoot = true;
  550.                attachMovie("laserShot","laserShot",780);
  551.                laserDir = -1;
  552.                laserShot._x = ballBounce._x - 35;
  553.                laserShot._y = ballBounce._y;
  554.             }
  555.          }
  556.       }
  557.       if(_root["bit" + i]._y + majorY < 900)
  558.       {
  559.          if(myBmp.getPixel(_root["bit" + i]._x - 5 - majorX,_root["bit" + i]._y - 25 + majorY) != 0)
  560.          {
  561.             _root["bitDirectionX" + i] = 1;
  562.          }
  563.          if(myBmp.getPixel(_root["bit" + i]._x + 5 - majorX,_root["bit" + i]._y - 25 + majorY) != 0)
  564.          {
  565.             _root["bitDirectionX" + i] = -1;
  566.          }
  567.          if(myBmp.getPixel(_root["bit" + i]._x - 5 - majorX,_root["bit" + i]._y + 20 + majorY) == 0)
  568.          {
  569.             _root["bitDirectionX" + i] = -1;
  570.          }
  571.          if(myBmp.getPixel(_root["bit" + i]._x + 5 - majorX,_root["bit" + i]._y + 20 + majorY) == 0)
  572.          {
  573.             _root["bitDirectionX" + i] = 1;
  574.          }
  575.       }
  576.       if(_root["bit" + i].hitTest(barLeft))
  577.       {
  578.          _root["bitDirectionX" + i] = -1;
  579.       }
  580.       if(_root["bit" + i].hitTest(barRight))
  581.       {
  582.          _root["bitDirectionX" + i] = 1;
  583.       }
  584.       _root["bit" + i]._xscale = _root["bitDirectionX" + i] * 100;
  585.       _root["bitMoveX" + i] += _root["bitDirectionX" + i] * _root["bitSpeedX" + i];
  586.       var _loc3_ = {x:_root["bit" + i].dirtPoint._x,y:_root["bit" + i].dirtPoint._y};
  587.       _root["bit" + i].dirtPoint.localToGlobal(_loc3_);
  588.       _root["bit" + i]._x = _root["bitStartX" + i] + majorX + _root["bitMoveX" + i];
  589.       _root["bit" + i]._y = _root["bitStartY" + i] - majorY + _root["bitMoveY" + i];
  590.       if(myBmp.getPixel(_root["bit" + i]._x - majorX,_loc3_.y + majorY) == 0 && myBmp.getPixel(_root["bit" + i]._x - majorX,_root["bit" + i]._y - 0 + majorY) == 0)
  591.       {
  592.          if(_root["bit" + i]._y >= barBase._y)
  593.          {
  594.             _root["bit" + i]._y = barBase._y;
  595.          }
  596.          else
  597.          {
  598.             _root["bitMoveY" + i] += 5;
  599.          }
  600.       }
  601.       else if(myBmp.getPixel(_root["bit" + i]._x - majorX,_loc3_.y + majorY) != 0)
  602.       {
  603.          _root["bitMoveY" + i] -= 5;
  604.       }
  605.       var _loc4_ = {x:_root["bit" + i].basePointLeft._x,y:_root["bit" + i].basePointLeft._y};
  606.       _root["bit" + i].basePointLeft.localToGlobal(_loc4_);
  607.       var _loc2_ = {x:_root["bit" + i].basePointRight._x,y:_root["bit" + i].basePointRight._y};
  608.       _root["bit" + i].basePointRight.localToGlobal(_loc2_);
  609.       if(myBmp.getPixel(_loc4_.x - majorX,_loc4_.y + majorY) == 0)
  610.       {
  611.          if(myBmp.getPixel(_loc2_.x - majorX,_loc2_.y + majorY) == 0)
  612.          {
  613.             _root["bit" + i]._rotation = 0;
  614.          }
  615.          else
  616.          {
  617.             _root["bit" + i]._rotation -= 5 * _root["bitDirectionX" + i];
  618.          }
  619.       }
  620.       else if(myBmp.getPixel(_loc2_.x - majorX,_loc2_.y + majorY) == 0)
  621.       {
  622.          _root["bit" + i]._rotation += 5 * _root["bitDirectionX" + i];
  623.       }
  624.       i++;
  625.    }
  626.    topMask.mapDisplay.ballSymbol._x = majorX / -10 + 20;
  627.    topMask.mapDisplay.ballSymbol._y = majorY / 10 + 27;
  628.    var i = 1;
  629.    while(i <= 30)
  630.    {
  631.       topMask.mapDisplay["bitMarker" + i]._x = (_root["bitStartX" + i] + _root["bitMoveX" + i]) / 10;
  632.       topMask.mapDisplay["bitMarker" + i]._y = (_root["bitStartY" + i] + _root["bitMoveY" + i]) / 10;
  633.       i++;
  634.    }
  635.    cleanSweep(0);
  636.    cleanSweep(-5);
  637.    cleanSweep(400);
  638.    cleanSweep(405);
  639.    cleanSweepVert(250);
  640.    cleanSweepVert(245);
  641.    cleanSweepVert(500);
  642.    cleanSweepVert(505);
  643.    xDistance = 200 - majorX;
  644.    do
  645.    {
  646.       if(xDistance > 300)
  647.       {
  648.          xDistance -= 300;
  649.       }
  650.    }
  651.    while(xDistance > 300);
  652.    
  653.    ballFrame = Math.ceil(xDistance / 10);
  654.    ballBounce.innerBall.gotoAndStop(ballFrame);
  655.    var i = 1;
  656.    while(i < 20)
  657.    {
  658.       _root["bombDrop" + i]._x = _root["bombDropX" + i] + majorX;
  659.       _root["bombDrop" + i]._y = _root["bombDropY" + i] - majorY + _root["bombDropMove" + i];
  660.       bombDropX = _root["bombDrop" + i]._x - majorX;
  661.       bombDropY = _root["bombDrop" + i]._y + majorY;
  662.       if(myBmp.getPixel(bombDropX,bombDropY) != 0 || myHouseBmp.getPixel(bombDropX,bombDropY) != 0)
  663.       {
  664.          blastArea = bombPower;
  665.          bombField(bombDropX,bombDropY,blastArea);
  666.          _root["bombDrop" + i].play();
  667.       }
  668.       else if(_root["bombDrop" + i].hitTest(_root.barBase))
  669.       {
  670.          _root["bombDrop" + i].play();
  671.       }
  672.       else if(_root["bombDrop" + i].exploded == false)
  673.       {
  674.          _root["bombDropMove" + i] += 5;
  675.       }
  676.       i++;
  677.    }
  678.    if(bombTimer > 0)
  679.    {
  680.       bombTimer -= 1;
  681.    }
  682.    displayX = xSpeed;
  683.    displayY = ySpeed;
  684.    if(drawAllowed == false)
  685.    {
  686.       mapHolder.drawLine.gotoAndStop(2);
  687.       mapHolder.drawLine._alpha -= 20;
  688.    }
  689.    xStart = _xmouse;
  690.    yStart = _ymouse;
  691.    attachLine._x = xStart;
  692.    attachLine._y = yStart;
  693.    lineX = xStart - 200;
  694.    lineY = yStart - 275;
  695.    lineDistance = Math.sqrt(lineX * lineX + lineY * lineY);
  696.    if(lineDistance < 15)
  697.    {
  698.       attachLine._alpha = 0;
  699.       startDraw = false;
  700.    }
  701.    else
  702.    {
  703.       attachLine._alpha = 50;
  704.       startDraw = true;
  705.    }
  706.    drawAngle = Math.atan((xStart - 200) / (yStart - 275)) / 0.017453292519943295;
  707.    if(yStart >= 275)
  708.    {
  709.       drawAngle = 90 - drawAngle;
  710.    }
  711.    else
  712.    {
  713.       drawAngle = 270 - drawAngle;
  714.    }
  715.    if(xStart > 200 && (drawAngle < 190 && drawAngle > 170))
  716.    {
  717.       drawAngle = 0;
  718.    }
  719.    if(xStart < 200 && (drawAngle < 10 || drawAngle > 350))
  720.    {
  721.       drawAngle = 180;
  722.    }
  723.    attachLine._rotation = drawAngle;
  724.    tracevar = xStart + "   " + drawAngle;
  725.    if(fireSpin == true || laser == true)
  726.    {
  727.       poweredUp = true;
  728.    }
  729.    else
  730.    {
  731.       poweredUp = false;
  732.    }
  733.    powerUpX += 3;
  734.    if(powerUpX >= 2000)
  735.    {
  736.       powerUpX = 0;
  737.       powerUpY = Math.random() * 900 + 50;
  738.    }
  739.    topMask.mapDisplay.powerUpMarker._x = powerUpX / 10;
  740.    topMask.mapDisplay.powerUpMarker._y = powerUpY / 10;
  741.    if(poweredUp == false && powerUpState == false)
  742.    {
  743.       powerUpX = Math.random() * 2000;
  744.       powerUpY = Math.random() * 900 + 50;
  745.       if(myBmp.getPixel(powerUpX,powerUpY) == 0)
  746.       {
  747.          attachMovie("powerUp","powerUp",750);
  748.          powerUpChoose = Math.random() * 100;
  749.          if(powerUpChoose > 75)
  750.          {
  751.             powerUpType = "blastRadius";
  752.          }
  753.          else if(powerUpChoose > 50)
  754.          {
  755.             powerUpType = "bombFreq";
  756.          }
  757.          else if(powerUpChoose > 25)
  758.          {
  759.             powerUpType = "laser";
  760.          }
  761.          else if(powerUpChoose > 0)
  762.          {
  763.             powerUpType = "fireSpin";
  764.          }
  765.          powerUp.symbol.gotoAndStop(powerUpType);
  766.          powerUpState = true;
  767.          topMask.mapDisplay.attachMovie("powerUpMarker","powerUpMarker",2050);
  768.       }
  769.    }
  770.    if(ballBounce.innerBall.hitTest(powerUp))
  771.    {
  772.       if(powerUpState == true)
  773.       {
  774.          powerUpState = false;
  775.          powerUp.gotoAndPlay("removePowerUp");
  776.          if(powerUpType == "blastRadius")
  777.          {
  778.             topMask.powerUpDisplay.gotoAndPlay("blastRadius");
  779.             bombPower += 20;
  780.          }
  781.          else if(powerUpType == "bombFreq")
  782.          {
  783.             topMask.powerUpDisplay.gotoAndPlay("bombFreq");
  784.             if(bombTimegap > 5)
  785.             {
  786.                bombTimegap -= 5;
  787.             }
  788.             else
  789.             {
  790.                bombTimegap = 5;
  791.             }
  792.          }
  793.          else if(powerUpType == "laser")
  794.          {
  795.             topMask.powerUpDisplay.gotoAndStop("laser");
  796.             laser = true;
  797.             fireSpin = false;
  798.             abilityTimer = abilityTimerMax;
  799.          }
  800.          else if(powerUpType == "fireSpin")
  801.          {
  802.             topMask.powerUpDisplay.gotoAndStop("fireSpin");
  803.             fireSpin = true;
  804.             laser = false;
  805.             abilityTimer = abilityTimerMax;
  806.          }
  807.       }
  808.    }
  809.    if(fireSpin == true)
  810.    {
  811.       ballBounce.hitZone._xscale = 150;
  812.       ballBounce.hitZone._yscale = 180;
  813.       ballBounce.fireSpin._alpha = 100;
  814.    }
  815.    else
  816.    {
  817.       ballBounce.hitZone._xscale = 55;
  818.       ballBounce.hitZone._yscale = 70;
  819.       ballBounce.fireSpin._alpha = 0;
  820.    }
  821.    if(laser == true)
  822.    {
  823.       ballBounce.laser._alpha = 50;
  824.    }
  825.    else
  826.    {
  827.       ballBounce.laser._alpha = 0;
  828.    }
  829.    if(laserShoot == true)
  830.    {
  831.       laserShot._x += 20 * laserDir;
  832.       if(myHouseBmp.getPixel(laserShot._x - majorX,laserShot._y + majorY) != 0 || laserShot._x < -50 || laserShot._x > 450)
  833.       {
  834.          laserShot.removeMovieClip();
  835.          laserShoot = false;
  836.       }
  837.    }
  838.    if(poweredUp == true)
  839.    {
  840.       abilityTimer -= 1;
  841.       if(abilityTimer == 0)
  842.       {
  843.          topMask.powerUpDisplay.gotoAndStop("none");
  844.          topMask.timeBar._alpha = 0;
  845.          fireSpin = false;
  846.          laser = false;
  847.       }
  848.       else
  849.       {
  850.          topMask.timeBar._alpha = 100;
  851.          topMask.timeBar.powerMask._xscale = abilityTimer / abilityTimerMax * 100;
  852.       }
  853.    }
  854.    topMask.chainDisplay.gotoAndStop(chainCrush);
  855.    if(chainLink > 0)
  856.    {
  857.       chainLink -= 1;
  858.       topMask.chainTimeBar._alpha = 100;
  859.       topMask.chainTimeBar.powerMask._xscale = chainLink / chainLinkMax * 100;
  860.    }
  861.    else
  862.    {
  863.       topMask.chainTimeBar._alpha = 0;
  864.       chainCrush = 1;
  865.    }
  866.    if(bitCount == 0)
  867.    {
  868.       if(ballFreeze == false)
  869.       {
  870.          ballBounce.gotoAndPlay("explode");
  871.          topMask.finishDisplay.play();
  872.       }
  873.       removeLine();
  874.       ballFreeze = true;
  875.    }
  876.    else
  877.    {
  878.       scoreDecreaseTimer += 1;
  879.       if(scoreDecreaseTimer == 30)
  880.       {
  881.          scoreDecreaseTimer = 0;
  882.          totalScore -= 10;
  883.       }
  884.    }
  885. };
  886.